import React from 'react';
import { connect } from 'dva';
import Link from 'umi/link'
import { Table } from 'antd';

import image1 from '../../assets/yay.jpg'
import image2 from '../../assets/yay.jpg'


const linePath = '/Partner/Person';

@connect(({ partnerOrgModel }) => ({ partnerOrgModel }))
class List extends React.Component {
  state = {
  }

  treeview = [
      {
        title: '',
        dataIndex: '_',
        render: (_, { id }) => {
          return <Link to={`${linePath}?id=${id}`}>查看</Link>;
        },
      },
      { title: '名称', dataIndex: 'name', },
      { title: '邮箱', dataIndex: 'email', },
      { title: '图片', dataIndex: 'image',
        render: (_, { image }) => {
          return (
            <img
              src={`data:image/jpeg;base64,${escape(image)}`}
              alt="example"
              style={{width: '20%',height:'20%' }}

            />
          );
        },
      },
  ]

  async componentDidMount() {
    const { dispatch } = this.props;
    dispatch({
      type: 'partnerOrgModel/listPerson',
      payload: {is_company: true},

    });
  }



  render() {
    const { partnerOrgModel: { recordsList } } = this.props;


    return (
      <div>

        <Table columns={this.treeview} dataSource={recordsList} rowKey="id" />

        <div>
          <ul>
            <li>
              <img
                alt="example"
                style={{width: '60%',height:'60%' }}
                src={image1}>
              </img>
            </li>
            <li>
              <img
                alt="example"
                style={{width: '60%',height:'60%' }}
                src={image2}>
              </img>
            </li>
            <li>
              <img
                alt="example"
                style={{width: '60%',height:'60%' }}
                src='https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1550849730905&di=4be43c4a8614db7d54668a8f865af7dd&imgtype=0&src=http%3A%2F%2Fc.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F5bafa40f4bfbfbedc92f87b675f0f736aec31f80.jpg'>
              </img>
            </li>
          </ul>
        </div>

      </div>
    );
  }
}

export default List;





